package volatileStudy;

/**
 * @author madonghui
 * @title: RepertSortTest
 * @projectName javaproject
 * @description: TODO
 * @date 2021/9/611:11 下午
 */
public class RepertSortTest {
    public static void main(String[] args) {
        Res res = new Res();
        res.testResult();
        System.out.println(res.a);
        System.out.println(res.b);
        System.out.println(res.x);
        System.out.println(res.y);
    }
}

class Res{
    int a,b,x,y = 0;

    public void ab(){
        x = a;
        b = 1;
    }

    public void xy(){
        y = b;
        a = 2;
    }

    public void testResult(){
        new Thread(()->{ab();},"a线程").start();
        new Thread(()->{xy();},"b线程").start();
    }
}
